public class Test_2024_9_19 {
    //leap year
    public static Boolean isLeapYear(int year){
        //被4整除并且不能被100整除或被400整除
        if((year%4==0 && 0!=year%100) || 0==year%400  ){
            return true;
        }else{
            return false;
        }
    }

    public  static int add(int x,int y){
        return x+y;
    }

    public static double add(double x,double y){
        return x+y;
    }
    public static double add(double x,double y,double z){
        return x+y+z;
    }

    public static void main(String[] args) {
        add(1,2);           //调用add(int x,int y)
        add(1.1,2.2);       //调用add(double x,double y)
        add(1.1,2.2,3.3);//调用add(double x,double y，double z)
    }
    public static int fac(int n){
        int result =1;
        for(int i=1;i<=n;i++){
            result *=1;
        }
        return result;
    }


    public static int getSum(int n){// n时形参
        return (1+n)*n/2;
    }
    //getsum(10);//10是实参，在方法调用时，形参n用来保存10

    //交换整形变量
    public static void swap(int x,int y){
        int temp=x;
        x=y;
        y=temp;
    }

    //用递归的方法解决“递归”

    public static int factor(int n){
        if(n==1)return 1;
        return n*factor(n-1); 
    }























    public static void main1(String[] args) {
        int a =10;
        int b =20;
        swap(a,b);
        System.out.println(a+" " +b);
    }



}
